<h1>
  <%= "#{@project.name} - Deploy ##{@deploy.id}" %>

  <div class="pull-right">
    <% if deployer_for_project? %>
      <%= redeploy_button %>

      <% if @deploy.succeeded? && next_stage = @deploy.stage.next_stage %>
        <% unless Lock.locked_for?(next_stage, current_user) %>
          <%= link_to "Deploy #{@deploy.short_reference} to #{next_stage.name}",
              new_project_stage_deploy_path(@project, next_stage, reference: @deploy.short_reference),
              class: "btn btn-primary"
          %>
        <% end %>
      <% end %>
    <% end %>

    <%= link_to "Back", @project, class: "btn btn-default" %>
  </div>
</h1>

<% if @deploy.job.waiting_for_restart? %>
  <%= render 'jobs/restarting' %>
<% else %>
  <%= status_panel @deploy %>
  <%= Samson::Hooks.render_views(:deploys_header, self, deploy: @deploy) %>
<% end %>
